import instance from "@/tools/axios";

const getCarShopDetail = (id: string) => {
  return instance.get("/SysCarShops/detail", { id });
};

const getCarShopPagination = (params: any) => {
  return instance.get("/SysCarShops/pagination", params);
};

const getProductPaginationByShopId = (params: any) => {
  return instance.get("/SysProduct/Pagination", params);
};

const addCarShop = (data: any) => {
  return instance.post("/SysCarShops/Add", data, {
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
};

const updateCarShop = (data: any) => {
  return instance.post("/SysCarShops/update", data);
};

const deleteCarShop = (id: string) => {
  return instance.post("/SysCarShops/delete", { id });
};

const toggleIsOpen = (id: string) => {
  return instance.get("/SysCarShops/toggleIsOpen", { shopId: id });
};

const toggleIsBan = (id: string) => {
  return instance.get("/SysCarShops/toggleIsBan", { shopId: id });
};

export {
  getCarShopDetail,
  getCarShopPagination,
  addCarShop,
  updateCarShop,
  deleteCarShop,
  getProductPaginationByShopId,
  toggleIsOpen,
  toggleIsBan,
};
